//
//  SLAreaCodeEntity.m
//  SLAppProduct
//
//  Created by Jianbo Cai on 2018/1/24.
//  Copyright © 2018年 Sunline. All rights reserved.
//

#import "JFAreaCodeEntity.h"

@implementation JFAreaCodeEntity

+ (NSArray *)getAllAreaCode {
    NSString *jsonPath = [[NSBundle mainBundle] pathForResource:@"AreaCode" ofType:@"json"];
    NSData *data=[NSData dataWithContentsOfFile:jsonPath];
    NSError *error;
    id jsonObject=[NSJSONSerialization JSONObjectWithData:data
                                                  options:NSJSONReadingAllowFragments
                                                    error:&error];
   return  [self arrToModle:jsonObject[@"AreaCode"]];
}
+(NSArray*)arrToModle:(NSArray*)arr{
    NSMutableArray * multArr = [[NSMutableArray alloc] init];
    if (arr && arr.count) {
        for (NSDictionary * dict in arr) {
            JFAreaCodeEntity * tempData = [[JFAreaCodeEntity alloc] init];
            tempData.ENName = dict[@"ENName"];
            tempData.CNName = dict[@"CNName"];
            tempData.Code = dict[@"Code"];
            [multArr addObject:tempData];
        }
        return [multArr copy];
    }else{
      return  [NSArray new];
    }
}
@end
